#define _CRT_SECURE_NO_WARNINGS 1
#include <climits>
#include <iostream>
using namespace std;
class Date
{
public:
    Date(int year, int month, int day)
        :_year(year)
        , _month(month)
        , _day(day)
    {}

    int getDay(int year, int month)
    {
        static int Day_arr[] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        if (month == 2 && ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)))
            return 29;
        else 
            return Day_arr[month];
    }

    int Count_day()
    {
        int count = 0;
        for (int i = _month - 1; i > 0; i--)
        {
            count += getDay(_year, i);
        }
        int re = count += _day;
        return re;
    }
private:
    int _year;
    int _month;
    int _day;
};

int main() {
    int year, month, day;
    cin >> year >> month >> day;
    Date d(year, month, day);
    cout << d.Count_day() << endl;
}